﻿namespace VectorPicsEditor.Helpers
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Shapes;

    public class NameGenerator
    {
        private int linesCounter = 0;
        private int rectsCounter = 0;
        private int ellipsesCounter = 0;
        private int pencilCounter = 0;
        private int imageCounter = 0;
        private int unknownShapesCounter = 0;
        private int textCounter = 0;

        public string Generate(FrameworkElement elem)
        {
            // for pencil drawings
            if (elem is Polyline)
            {
                pencilCounter++;
                return "Pencil " + pencilCounter;
            }

            if (elem is Rectangle)
            {
                rectsCounter++;
                return "Rectangle " + rectsCounter;
            }

            if (elem is Ellipse)
            {
                ellipsesCounter++;
                return "Ellipse " + ellipsesCounter;
            }

            if (elem is Line)
            {
                linesCounter++;
                return "Line " + linesCounter;
            }

            if (elem is Image)
            {
                imageCounter++;
                return "Image " + imageCounter;
            }

            if(elem is TextBlock)
            {
                textCounter++;
                return "Text " + textCounter;
            }
            // uppend here the list of the rest shapes

            unknownShapesCounter++;
            return "Shape " + unknownShapesCounter;
        }
    }
}